package com.baizhi.lql.controller;

import com.baizhi.lql.service.VideoService;
import com.baizhi.lql.vo.AppMainVO;
import com.baizhi.lql.vo.AppVideoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController  // @Controller + @ResponseBody
@RequestMapping("app")
public class AppController {
    @Autowired
    private VideoService videoService;

    @RequestMapping(value = "queryByReleaseTime", method = RequestMethod.POST)
    public AppMainVO queryByReleaseTime(){
        AppMainVO mainVO = new AppMainVO();

        try{
            List<AppVideoVO> appVideoVOS = videoService.queryByReleaseTime();
            mainVO.setData(appVideoVOS);
            mainVO.setMessage("查询成功");
            mainVO.setStatus("100");
        }catch (Exception e){
            mainVO.setMessage("查询失败");
            mainVO.setStatus("104");
        }
        return mainVO;
    }
}
